package fifthwork.two;

import fifthwork.two.Shape;
import fifthwork.two.inherit.CircleShape;
import fifthwork.two.inherit.RecTangleShape;
import fifthwork.two.inherit.TriangleShape;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ：chenzikang
 * @date ： 2020/3/24
 */

public class ShapeTest {

    public static void main(String[] args) {
        //园的实例化
        CircleShape circleShape = new CircleShape(3.0);

        //矩形的实例化
        RecTangleShape rectangleShape = new RecTangleShape(5, 3);

        //三角形的实例化
        TriangleShape triangleShape = new TriangleShape(2.5, 5);

        //创建动态数组
        List<Double> lists = new ArrayList();




        //求得对应的面积
        double circleArea = circleShape.area();
        double recTangArea = rectangleShape.area();
        double triangleArea = triangleShape.area();

        //存入lists中
        lists.add(circleArea);
        lists.add(recTangArea);
        lists.add(triangleArea);

        //打印出相应的面积
        System.out.println("圆的面积是" + lists.get(0));
        System.out.println("矩形的面积是" + lists.get(1));
        System.out.println("三角形的面积是" + lists.get(2));


}


}
